<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        div {
            z-index: -1;
            position: absolute;
            width: 100px;
            height: 100px;
            background-color: pink;
            left: 0;
        }
        
    </style>
    <script src="animate.js"></script>
</head>

<body>
    <div></div>
    <button class="btn800">点击到800</button>
    <button class="btn500">点击到500</button>
    <script>
        var div = document.querySelector('div')
        var btn800=document.querySelector('.btn800')
        var btn500=document.querySelector('.btn500')
        btn800.addEventListener('click',function(){
            animate(div,800)
        })
        btn500.addEventListener('click',function(){
            animate(div,500)
        })
       
    </script>
</body>

</html>